package com.market.product.remote.factory;

import com.market.common.core.domain.Result;
import com.market.product.remote.RemoteProductService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;

public class RemoteProductServiceFallback implements FallbackFactory<RemoteProductService> {
    private static final Logger log = LoggerFactory.getLogger(RemoteProductServiceFallback.class);
    @Override
    public RemoteProductService create(Throwable throwable) {
        log.error("商品服务调用失败:{}", throwable.getMessage());





        return new RemoteProductService() {
            @Override
            public Result updateProductInventory(Integer productId, Integer stock) {
                return Result.error("商品库存更新失败"+throwable.getMessage());
            }

            @Override
            public Result queryPriceBySkuId(Long id) {
                return Result.error("商品价格失败"+throwable.getMessage());
            }



        };
    }
}
